﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using IBusinessLogicLayer;
using IDataAccessLayer;

namespace BusinessLogicLayer
{
    //不再设为抽象类 对一些只有简单访问的类不用重新写单独的Bll
    public class BaseBll<T>:IBaseBll<T> where T:class
    {
        protected IBaseDal<T> baseDal { get; set; }

        public BaseBll(IBaseDal<T> dal)
        {
            baseDal = dal;
        }

        public bool Insert(T t)
        {
            return baseDal.Insert(t);
        }


        public bool Delete(Expression<Func<T, bool>> condition)
        {
            return baseDal.Delete(condition);
        }

        public bool Update(Expression<Func<T, bool>> match, Expression<Func<T, T>> t)
        {
            return baseDal.Update(match, t);
        }

        public ICollection<T> Find(Expression<Func<T, bool>> match)
        {
            return baseDal.Find(match);
        }

        public T FindSingle(Expression<Func<T, bool>> match)
        {
            return baseDal.FindSingle(match);
        }

        public IQueryable<T> GetQueryable()
        {
            return baseDal.GetQueryable();
        }
    }
}
